Repository navigation
cli: don't pre-split blocks with --patch-from - #5058
Merged
Merged
Conversation
The pre-splitter (#4136, v1.5.7) makes --patch-from patches 12-18% larger on a 120 MB patch, at the same speed.
terrelln
approved these changes
Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This affects
zstd --patch-fromusers: since v1.5.7, patches are larger than with v1.5.6. Library users are unaffected.Problem
The pre-splitter added in v1.5.7 (#4136; bisected to a5bce4a) cuts 128 KB blocks before match finding, based on byte statistics.
With
--patch-from, it makes patches 12-18% larger, at the same speed.With
--long=27alone, on the same file, it costs only 0.4-0.75%.Fix
In
--patch-frommode, the CLI setsZSTD_c_blockSplitterLevelto 1 (no pre-splitting), which restores the v1.5.6 block boundaries.The post-splitter (
ZSTD_c_splitAfterSequences, levels 16+) is unchanged.Measurements
120 MB patch: concatenated zstd source tarballs up to v1.5.6 as reference, up to v1.5.7 as target,
-T1. Every patch decodes back with--patch-apply.-3-9-15-19Percentages are relative to v1.6.0;
devgives the same sizes as v1.6.0.At
-3, sizes are the same with the default thread count and with-T4.-15is slower since v1.5.7 because the LDM parameters now depend on the strategy (4609a40, f26cc54, 72406b7), which also improves the ratio: with this PR, patches are 5-12% smaller than with v1.5.6.